/** \file InstrumentPerc.h
    \author belot.nicolas
    Manage an multiphonic instrument like a flute
*/

#ifndef INSTRUMENTPERC_H
#define INSTRUMENTPERC_H 1

#include <queue>
#include <deque>
#include <map>
#include "Instrument.h"

namespace libtrckr {

class InstrumentPerc : public Instrument {
/** \class libtrckr::InstrumentPerc
	\brief Percussion.
*/
public :
	//Constructor
	//should be ...Instrument is an interface.
	InstrumentPerc();
	InstrumentPerc( string );//,name
	InstrumentPerc( const InstrumentPerc&);
	~InstrumentPerc();

	//Accessor
	//Information
	string getName() const ;
	DynArray<string> getTuning() const;//Huh! vector :s
	DynArray<string> getAttacks() const;

	//Creation 
	void setName( string );
	void setTuning( DynArray<string> );
	void setNote( string, string,float,short,short,short);// ça devrais plutot prendre un string filename.
	void setAttack(string**);
	void setAttack(DynArray<string>);

	//Function working with the rest of the libs.
	 Buffer play( uint );//play xsample.
	 Buffer& play( Buffer & );//play xsample.
	 void addNote(string, Duration::note_duration_t,bool, uint,short,short,DynArray<PlayingEffect*>* ) ;
	 void addNote(Note, uint,short,short,DynArray<PlayingEffect*>* ) ;
	bool end() const;
	void letRing(bool);
private:
	struct Splay {
		Sample *sample;
		uint elapsed;
		uint duration;
		double volume;
		uint panning;
		double ratio;
		DynArray<PlayingEffect*>* effects;
	};
	string _name;

	string _tune; 
	uint8_t nb_string;
	DynArray<queue<INote>*> _partitions;
	DynArray<map<string, INote>*> _samples;
	DynArray<string> attack;
	uint8_t nb_attack;
	map<string, Splay> current;
	bool ring;

};

}

#endif

